﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace BISPOS
{
    public partial class ProductDetail : DevExpress.XtraEditors.XtraUserControl
    {
        Product _product;
        EditProductUserControl _editProductUserControl;
        public ProductDetail(Product product,EditProductUserControl editProductUserControl)
        {
            InitializeComponent();
            _product = product;
            _editProductUserControl = editProductUserControl;
            this.productBindingSource.DataSource = product;
            this.stocksBindingSource.DataSource = product.Stocks;
            this.currentPriceLabelControl.Text = "ราคาขายปัจจุบัน: " + product.CurrentPrice.Amount.ToString("n2") + " บาท";


        }

        private void stockGridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            
        }

        private void updateStock_Click(object sender, EventArgs e)
        {
            UpdateStockXtraForm form = new UpdateStockXtraForm((Product)this.productBindingSource.DataSource);
            form.Show();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChangePriceXtraForm form = new ChangePriceXtraForm(_product, _editProductUserControl);
            form.Show();
        }
    }
}
